home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / datlnk.zip / DATELINK.DOC < prev    next >
Text File  |  1993-01-04  |  4KB  |  114 lines

  1.  
  2.  
  3.  
  4.                           DATELINK unit
  5.  
  6.           A TP 5.5 OOP unit for keeping track of dates
  7.  
  8.             Rob Rosenberger        CIS: 74017,1344
  9.             Barn Owl Software      VOX: (618) 632-7345
  10.             P.O. Box #74           BBS: (618) 398-5703
  11.             O'Fallon, IL  62269    HST: (618) 398-2305
  12.  
  13.      This unit provides a heap-managed linked list object (OOP)
  14. which keeps track of any number of dates in sorted order.  It was
  15. originally set up to store dates corresponding to holidays but,
  16. because of the nature of OOP, you can use DateLink variables to
  17. keep track of multiple linked lists of dates for any purpose.
  18.  
  19.      The DateLink unit builds on the OBJECTS.PAS unit from disk
  20. #3 of the TP 5.5 master disk set, the OBJECTA.PAS unit available
  21. on CompuServe in the BPROGA forum, LIB 1, filename OBJA.ARC, and
  22. on the TpDate unit supplied by TurboPower Software in their TPRO5
  23. toolkit.  (OBJECTS.PAS and TpDate are copyrighted works.)
  24.  
  25.      The DateLink unit requires DATEOBJ.PAS, another unit that
  26. builds on OBJECTS.PAS.  The DateObj source should be kept in the
  27. same directory with the DateLink source.  DateObj is transparent
  28. to the programmer -- DateLink is the one that does all the work
  29. for you.  Therefore, DateObj's capabilities are beyond the scope
  30. of this documentation.
  31.  
  32.  
  33. Version 1.00: released to the public domain on 8 July 1989.
  34.  
  35.  
  36.  
  37.  
  38. TYPE
  39.    DateLinkList
  40.     = OBJECT(LinkList)
  41.       CurrentDatePtr : DateObjectPtr;
  42.  
  43.       CONSTRUCTOR Init;
  44.       PROCEDURE   AddDate(TheDate : Date);
  45.       PROCEDURE   DeleteDate(TheDate : Date);
  46.       FUNCTION    Exists(TheDate : Date) : BOOLEAN;
  47.       FUNCTION    CurrentDate : Date;
  48.       FUNCTION    FirstDate : Date;
  49.       FUNCTION    LastDate : Date;
  50.       PROCEDURE   Advance;
  51.       END;
  52.  
  53.  
  54. CONSTRUCTOR DateLinkList.Init;
  55.  
  56.      This procedure initializes the DateLinkList variable.  The
  57. Done destructor (inherited) should be used to free up the heap
  58. space associated with the list.
  59.  
  60.  
  61. PROCEDURE   DateLinkList.AddDate(TheDate : Date);
  62.  
  63.      This procedure stores TheDate in the list.  It does nothing
  64. if TheDate already exists on the list.
  65.  
  66.  
  67. PROCEDURE   DateLinkList.DeleteDate(TheDate : Date);
  68.  
  69.      This procedure deletes TheDate from the list.  It does
  70. nothing if TheDate doesn't exist on the list.
  71.  
  72.  
  73. FUNCTION    DateLinkList.Exists(TheDate : Date) : BOOLEAN;
  74.  
  75.      This function determines if the date exists on the list.
  76.  
  77.  
  78. FUNCTION    DateLinkList.CurrentDate : Date;
  79.  
  80.      The DateLinkList variable type keeps a pointer to what it
  81. knows to be the "current" date.  This lets the Advance function
  82. move on to the next date without the programmer having to worry
  83. about it.  The FirstDate function initializes CurrentDate; so you
  84. can then use the Advance function to get successive dates on the
  85. list.  CurrentDate returns BadDate (defined in TPRO5 TpDate) if
  86. you advance beyond the last date on the list.
  87.  
  88.  
  89. FUNCTION    DateLinkList.FirstDate : Date;
  90.  
  91.      This function simply returns the first date in the list.
  92. Remember, the list is sorted in ascending order by date.  BadDate
  93. (defined in TPRO5 TpDate) is returned if there are no dates on
  94. the list.  CurrentDate will return the same date after you call
  95. this function.
  96.  
  97.  
  98. FUNCTION    DateLinkList.LastDate : Date;
  99.  
  100.      This function simply returns the last date in the list. 
  101. Remember, the list is sorted in ascending order by date.  BadDate
  102. (defined in TPRO5 TpDate) is returned if there are no dates on
  103. the list.  CurrentDate will return the same date after you call
  104. this function.
  105.  
  106.  
  107. PROCEDURE   DateLinkList.Advance;
  108.  
  109.      This procedure advances the current-date pointer to the next
  110. date in the list.  Use the CurrentDate function to find out the
  111. current date.  If you advance past the last date on the list, the
  112. CurrentDate function will return with BadDate (defined in TPRO5
  113. TpDate).
  114.